UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zO3Nz6/Ac32n+agub3NC/mBPQ+OwsJdh+SLt58RpKGw='
WHERE
key_id = 'd50b571def90af9ddcacce5940b0179f11840b295401342186a042da99a8cff5'
AND (
token = 'zO3Nz6/Ac32n+agub3NC/mBPQ+OwsJdh+SLt58RpKGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)