UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mkjzv3K0xssJJgCV+vRaSK6GwVFrj5650fS87CngHWA=' 
WHERE 
  key_id = '638d00b9fc7e346a0fd274ae3c28702ff371b2aec82cc622fdd8746b501b4845' 
  AND (
    token = 'mkjzv3K0xssJJgCV+vRaSK6GwVFrj5650fS87CngHWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027