UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y3jimStFp4NKgyQMxYrHSkbnDkRWhoOdmnFIFtn+8WU=' 
WHERE 
  key_id = '7b9b89c75a8aef1bcde9743d648f12e5a3eb6e649fd2f6d4ede42b42c9d0b17f' 
  AND (
    token = 'Y3jimStFp4NKgyQMxYrHSkbnDkRWhoOdmnFIFtn+8WU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022