UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YDmcEmqb2gJ1tRztlju2zXJdB3fIUp6nw2tYQzjdm08='
WHERE
key_id = 'dea001b1029820c6e9b330d308ca7d36961c1c82df37e24ca638a3350e6b15bf'
AND (
token = 'YDmcEmqb2gJ1tRztlju2zXJdB3fIUp6nw2tYQzjdm08='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)