UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x6jJg5yvquW9umlI3GYcaPjDUbRdn4+XmSbNMoUdaSY='
WHERE
key_id = 'ebfe454f87228469694cd71c847d39ec0fcfef15d0276ec3a6677e127e142c76'
AND (
token = 'x6jJg5yvquW9umlI3GYcaPjDUbRdn4+XmSbNMoUdaSY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)