UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A0V2E+P9S+PxDV+0U3d2NuV5WkRtCdizZpq+bqtD174='
WHERE
key_id = 'a7d3b8d20cf2e3dfeddc32b5eb72ec6070a5254da58e752e09f416124339fe0c'
AND (
token = 'A0V2E+P9S+PxDV+0U3d2NuV5WkRtCdizZpq+bqtD174='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)