UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nw6Sypj2TnMiakQ4jEV/v3btlucyMm4Qav532Nx3St8='
WHERE
key_id = 'e30312583adf5f0afdac86e20388ff6ad13557d3f66806f104846dcd4f51ff6a'
AND (
token = 'nw6Sypj2TnMiakQ4jEV/v3btlucyMm4Qav532Nx3St8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)