UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xaYUQ0lk7UDuRPu745OauqbbvAH+Ei5qttyvXdcnQtc=' 
WHERE 
  key_id = '894edfeec912f26937268a188b17ae41ba2bf75957bd0ad700fcc10d4f9e9e9e' 
  AND (
    token = 'xaYUQ0lk7UDuRPu745OauqbbvAH+Ei5qttyvXdcnQtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053