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