UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uCNaq/mbIa0WnGRuaFtVFTTjYngaLm5yS28mTlUr8Vw=' 
WHERE 
  key_id = '1c40a8424e3e0e97a6e0b097d7d51411b0a577aac38f7e34fdbb9df3cf4adb67' 
  AND (
    token = 'uCNaq/mbIa0WnGRuaFtVFTTjYngaLm5yS28mTlUr8Vw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024