UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SXqtb96KGpgrzcyB6VwxdxoxKSFz/W/7Nsr0ZL8D2dI=' 
WHERE 
  key_id = '5274107311f58aa26df17a16827d7e52b9a07ce6f837729ae827ba42a3a3fcdd' 
  AND (
    token = 'SXqtb96KGpgrzcyB6VwxdxoxKSFz/W/7Nsr0ZL8D2dI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037