UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tpyHhfKS/xKhEY9Qiahq61GOxgxXli650+Z5Nei/fDs='
WHERE
key_id = '1ef712a175bb22b898f4c7d3b78dfebe62e15f4bc16fe2f59fdb809b8e48df31'
AND (
token = 'tpyHhfKS/xKhEY9Qiahq61GOxgxXli650+Z5Nei/fDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)