UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y5N5mGFIDR/1WSU9pF6Ru+cM2AoAufPMZBBWF3pO1dY=' 
WHERE 
  key_id = '9f1ab0f176ec3bf46b5682a85d862d63000647e48d68df014292d4f08157dcec' 
  AND (
    token = 'y5N5mGFIDR/1WSU9pF6Ru+cM2AoAufPMZBBWF3pO1dY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034