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

Query time 0.00026