UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dcCElSE/y9SN+N4/TrKyGQ1vLlzHboywv3XxEPvOMZU=' 
WHERE 
  key_id = '54858f0809783b91d6aa2be8d0514c96a02be8012b6bbd521d67c905d2534897' 
  AND (
    token = 'dcCElSE/y9SN+N4/TrKyGQ1vLlzHboywv3XxEPvOMZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057