UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fW65YsJlxiyw/3Xjtr4Q7bC99dK34nkwFEMwClXQtbk='
WHERE
key_id = '3b71d865545cc75094276d14aa45ded6c7b6cf706f814cb287ee6f2f21c642fc'
AND (
token = 'fW65YsJlxiyw/3Xjtr4Q7bC99dK34nkwFEMwClXQtbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)