UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lIoiPqdWF87uF+b1M5OjujbAx3dU3JkIiXDIict4aXA=' 
WHERE 
  key_id = '759aa0b1808b3345283f8e0f0872825c7bbe83c788e52910ef0aba49a65dec1a' 
  AND (
    token = 'lIoiPqdWF87uF+b1M5OjujbAx3dU3JkIiXDIict4aXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016