UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N//fIAAhm5K+5vJfBn30mofZMaktyULfHHGfPfp6rds='
WHERE
key_id = 'bef37d6a1f18c1e9a6420f856ea60a63165722c055ed7fb0e3c4a5e6cfc4e68a'
AND (
token = 'N//fIAAhm5K+5vJfBn30mofZMaktyULfHHGfPfp6rds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)