UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'es+S4a+mxP8hBTjYTkDLFgqaTUDEhd+YYoC/6q381as='
WHERE
key_id = 'd0123c067c54bc4d186044e737f0425ed83db3b0cab2ecc6cf85fff22fe8ebbd'
AND (
token = 'es+S4a+mxP8hBTjYTkDLFgqaTUDEhd+YYoC/6q381as='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)