UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rf5YFJscrVsTOwUqScYxC7eH+n/4DISTRw/m/A3tzZ8=' 
WHERE 
  key_id = 'fff47ba41a7f9266a01a91f8e2318012c02d036f32478ee848c5623e4b4e3f3f' 
  AND (
    token = 'Rf5YFJscrVsTOwUqScYxC7eH+n/4DISTRw/m/A3tzZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057