UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lohPcXvBZJiOXWmcJHfGE3b93a6xKdfEyvR87fgpGVg='
WHERE
key_id = '177fab941561c2ce1a5bbfddff9087b8ddd3629d98b9010aa928b3502bb9943a'
AND (
token = 'lohPcXvBZJiOXWmcJHfGE3b93a6xKdfEyvR87fgpGVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)