UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q6iIyw32wICWvCppfD8CGnIT9UFxdmxqTwdz5TyoHgo='
WHERE
key_id = '66e27f41950db7c26178709419a8e3f2ca881306f284d75eb1864c0fff391736'
AND (
token = 'q6iIyw32wICWvCppfD8CGnIT9UFxdmxqTwdz5TyoHgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)