UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CsT0eFx/F2nVphkK0RCxuOE9CiCJERp+YMRTKrECCQ8='
WHERE
key_id = '59cdafe096929269d5e490c26959472c36230afbdfdfcdc65aeb4930174900e7'
AND (
token = 'CsT0eFx/F2nVphkK0RCxuOE9CiCJERp+YMRTKrECCQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)