UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PtgDzSPnR7xhQ/8UMR2BGHrpQUlZs2KpqmMV3kvEkYI=' 
WHERE 
  key_id = '61ef3c329547305a0853d8fb50a8820b965becedf66d65661bc516572885838c' 
  AND (
    token = 'PtgDzSPnR7xhQ/8UMR2BGHrpQUlZs2KpqmMV3kvEkYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026