UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HBqQCrY/REzAo3F3cJicJ0jUNgRbBaV9AsRiZ+OAvK8=' 
WHERE 
  key_id = 'da4a6dbca1d14538ec03ae57f0516ec0b869ffec7269b8678cc74cb0ad8519f0' 
  AND (
    token = 'HBqQCrY/REzAo3F3cJicJ0jUNgRbBaV9AsRiZ+OAvK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028