UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gtyso/+C0DBwXte9oTocCIVFiv44GNzsUFFZaQmK1Uw=' 
WHERE 
  key_id = 'a792cc4696fcaee61fdd9047942b1b76cca9d60115ef5f43be6f84921966c3bd' 
  AND (
    token = 'gtyso/+C0DBwXte9oTocCIVFiv44GNzsUFFZaQmK1Uw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027