UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sZi7f7G38JUEBUQPbRE1Yb7I6mCCTi7mzb8w4U+kazo='
WHERE
key_id = '530bbe8729f8605601ea43b15a1fdee44addb871915984c523150ede09c072f2'
AND (
token = 'sZi7f7G38JUEBUQPbRE1Yb7I6mCCTi7mzb8w4U+kazo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)