UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N43vBsJrTl81Cmaaezv+5BrLf1jWwS5Yvxsr3QgnG1c='
WHERE
key_id = '874f9f2e0a718a56efab010d2c51e48db6063c257e409ec502c30e13b4396af8'
AND (
token = 'N43vBsJrTl81Cmaaezv+5BrLf1jWwS5Yvxsr3QgnG1c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)