UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wEf+iaUHzT31qUiqvmMRn3KFhxT0lH4MUJ4U/WN9mwo='
WHERE
key_id = 'f07f3a696645b0a0c186b78da440859351ffe0faaad8808cd55831d48accdec3'
AND (
token = 'wEf+iaUHzT31qUiqvmMRn3KFhxT0lH4MUJ4U/WN9mwo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)