UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5dQ5Y1b0SfBuBmHFFinXmx00JG3fgOEUbZK1lIAflU=' 
WHERE 
  key_id = '5216c5664ad1006d8e53f438b8d8806f3c2c66efedf4bb27a39c6af1c04d77e6' 
  AND (
    token = 'G5dQ5Y1b0SfBuBmHFFinXmx00JG3fgOEUbZK1lIAflU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082