UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TK3lJ+RfJf7I4V3qDgszBKYG62QLG7+47s4OrVUsAgw=' 
WHERE 
  key_id = '7b29ce4aae0e4a562ff8c187d3482bed06ae0e1e9dba76db99039b7dee2cb580' 
  AND (
    token = 'TK3lJ+RfJf7I4V3qDgszBKYG62QLG7+47s4OrVUsAgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038