UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kc5Unn98UAFFCCJ0cRqvq05XvENcEOnqQpxa7E2X+ks=' 
WHERE 
  key_id = '508df73eeb5974f6e014340ef77767cc7ce22bc48e067993a6d5cdbe25fe3c5f' 
  AND (
    token = 'kc5Unn98UAFFCCJ0cRqvq05XvENcEOnqQpxa7E2X+ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073