UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X11juzlXbcA7E8Df/HKMgaAL8ElkqmQ8059rifWzJys=' 
WHERE 
  key_id = 'b56350ec9020fd218b736a35c86f68a6675fe8c9201fbf0e08be779304296ea5' 
  AND (
    token = 'X11juzlXbcA7E8Df/HKMgaAL8ElkqmQ8059rifWzJys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061