UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '587rPD3ws2uX4H8vjK0yrAs/QFhY+x8t4nBD6pHJ2c8='
WHERE
key_id = '9af9c34c8c87d23197f768d6ad1c0b9591c4e35b394c07730e29c6e2cdc5b700'
AND (
token = '587rPD3ws2uX4H8vjK0yrAs/QFhY+x8t4nBD6pHJ2c8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)