UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eS/rAIk7TcJLmaL+zJuhxOlseiwYrq0NO4y5Iy914wE='
WHERE
key_id = '417f2b9d2a41be016bd0fa475615f9673486dda8c3a169a14974763023963038'
AND (
token = 'eS/rAIk7TcJLmaL+zJuhxOlseiwYrq0NO4y5Iy914wE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)