UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vJbr1E+liRdvWtM66WqAljDvMKmlNbfPHe8jivrAUwo=' 
WHERE 
  key_id = 'a3b07cbfdac3ed8c9e02c811d2fb1ae6ef5e35efaed03a1bf5a8bb4a6698c381' 
  AND (
    token = 'vJbr1E+liRdvWtM66WqAljDvMKmlNbfPHe8jivrAUwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043