UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQBYaFgXobjFxpT5aucCxAE0aNL+zZeb83eCL9w6LFY=' 
WHERE 
  key_id = '258754e41ef72482d9f0f1fb214fa613068b94213905622348f9f2be884f68a7' 
  AND (
    token = 'KQBYaFgXobjFxpT5aucCxAE0aNL+zZeb83eCL9w6LFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041