UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6BvBLyfFo4hNszIHLymyLxgDeIZklFknmES+7hTSWY8='
WHERE
key_id = '50ba08b5bc18d0e655ee9d5bb22eabd9e265ba14253b2a702b0f4ca9bf2dc00d'
AND (
token = '6BvBLyfFo4hNszIHLymyLxgDeIZklFknmES+7hTSWY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)