UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n7mWkZ2W5T1k/nPtwrLusON4O/a0aCRPdsiOi6/mNnc=' 
WHERE 
  key_id = '11e3a13d7801ca59260728a3ed08e7139ae7f8e9363d7fd2e16af40b12ade795' 
  AND (
    token = 'n7mWkZ2W5T1k/nPtwrLusON4O/a0aCRPdsiOi6/mNnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043