UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Afmeg/+OtC5m+trNFB19o/Wa1hiNZQ9RPjYevLJ+Zs8=' 
WHERE 
  key_id = '2a9e6f27e6a901c118bf5d318620dfa4e680123500b76528d8e7c93e20b63b91' 
  AND (
    token = 'Afmeg/+OtC5m+trNFB19o/Wa1hiNZQ9RPjYevLJ+Zs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045