UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GYhU8WQas7GGQaqvjBKXSXQoXOlGcdhMGLz3cpDAgEk='
WHERE
key_id = '506303b2336e0714469ed6ad23d22a482c86d5a48d01b0290c6fbb962c1a8e3c'
AND (
token = 'GYhU8WQas7GGQaqvjBKXSXQoXOlGcdhMGLz3cpDAgEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)