UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y9wFzH9sXEK6mwyo31PRywIAtFBC7kUZXNjCQvkdwEs=' 
WHERE 
  key_id = '76c9e6712ed2f2860eb5022d558c41d29f28e79275bff3c7a2e262760e24b16b' 
  AND (
    token = 'Y9wFzH9sXEK6mwyo31PRywIAtFBC7kUZXNjCQvkdwEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029