UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AXpgCVIRv6Gz2xT/4el/KBtL7Q8a6wM6zZ7FBeZyne0=' 
WHERE 
  key_id = '9b8704961160ee4b6be20c120697427836263bfe6f71c7c333675c7fd1f18239' 
  AND (
    token = 'AXpgCVIRv6Gz2xT/4el/KBtL7Q8a6wM6zZ7FBeZyne0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027