UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n0D0k32HBS7wyq8xjrD/Vc5F1pd67gxo22GnxIRpJMU=' 
WHERE 
  key_id = '8eea8daa1b5b2f92919503ca3bde51855bdfed06653f60af61e645723fb09f40' 
  AND (
    token = 'n0D0k32HBS7wyq8xjrD/Vc5F1pd67gxo22GnxIRpJMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028