UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z9PqU8Ev4cPJDrSu749YP99ps7taCt+Ajrz83DSSAY4='
WHERE
key_id = '1493ba2a8cbda0a6cfafdb5545151b006c3c082c28f596581b35122e6f230478'
AND (
token = 'Z9PqU8Ev4cPJDrSu749YP99ps7taCt+Ajrz83DSSAY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)