UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hJ+bWLI44TMmlTInv4nXF9a0Rdrdvqc7KU8X2gRh1bc='
WHERE
key_id = '9fef251bc31beba54532dd8cd30e8af880672336e29847d7bc97a3d0217de2c5'
AND (
token = 'hJ+bWLI44TMmlTInv4nXF9a0Rdrdvqc7KU8X2gRh1bc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)