UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'psLQXZfImSsAnbLmnTwCDmvGRMii8YZOqaoEQJJ5dY0='
WHERE
key_id = 'f1d916402e328c0c169e7cfbee65ebacd9c23d453335ebfb6ac7f4e1ac48ebd5'
AND (
token = 'psLQXZfImSsAnbLmnTwCDmvGRMii8YZOqaoEQJJ5dY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)