UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dWF31B/yNb90675lOwc2uJTH2kINODqwKra3WXNTPtc='
WHERE
key_id = '05585e609ee85ea587af201e53994b5da23d44333c974b3608d5f3c4b537413d'
AND (
token = 'dWF31B/yNb90675lOwc2uJTH2kINODqwKra3WXNTPtc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)