UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eGXes1+JILhghWFz4N+WGy3sdoF0I/uAfxRlCpuij6w=' 
WHERE 
  key_id = 'c8bc2603727ae8705920d839bd7e207f6b61ac749bcc957e722e0477de955a85' 
  AND (
    token = 'eGXes1+JILhghWFz4N+WGy3sdoF0I/uAfxRlCpuij6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047