UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6w51tmEH6jDYXAMxY5u8E6ke6NUxJOSyZ9H0739m6NA='
WHERE
key_id = 'b22f8ecc857dff8c58bf06e603a80e38fe500e0280e187c086be0a0f4f49804c'
AND (
token = '6w51tmEH6jDYXAMxY5u8E6ke6NUxJOSyZ9H0739m6NA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)