UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0uKSf+Wnn5QBtOAejpacvq4pkd+Yzjw49btqvboFM2I=' 
WHERE 
  key_id = 'ac8032ba5a658f1965a884bedcbba6d03789ac835cdbe11a0d55d92edf707543' 
  AND (
    token = '0uKSf+Wnn5QBtOAejpacvq4pkd+Yzjw49btqvboFM2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046