UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hqIub5OCpk1ZvfPHIdNt8U9tnJv9x1AWhx3XgB7ZWiY=' 
WHERE 
  key_id = 'e85370a8af021852e7e4a6011a0514e6ac67a6b65c5e63cd9693d29249b7bbb6' 
  AND (
    token = 'hqIub5OCpk1ZvfPHIdNt8U9tnJv9x1AWhx3XgB7ZWiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031