UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G8D8pWR9O0XLBI+L/lAm4yUdpKEefyaXxs4Xn2I2ClI='
WHERE
key_id = 'bc9402b0dae8d100037bb28b6f843fa62ea7fafb1a1e2b0015149621ab81f7cc'
AND (
token = 'G8D8pWR9O0XLBI+L/lAm4yUdpKEefyaXxs4Xn2I2ClI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)