UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6/e8AcgEnojNxz/3ZdJ3zgzyxM/KRoHUnvRRJNY1rRs='
WHERE
key_id = '557c717aefeb761730fa098ea7aaf377f8117ec508427333345de55ae7e12c20'
AND (
token = '6/e8AcgEnojNxz/3ZdJ3zgzyxM/KRoHUnvRRJNY1rRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)