UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OZJ3EMs3TIEW37vNaRp2+R8K4mDWovAgY9nrqoxYAdg=' 
WHERE 
  key_id = '3b83acbad3b39d8e7159532537b59051bbd13cc5bb56d6ebf4bed9a972088bd1' 
  AND (
    token = 'OZJ3EMs3TIEW37vNaRp2+R8K4mDWovAgY9nrqoxYAdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039