UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0RQ0pDCjlb+aR+zvPg2Tn9oVwQAlUxWCgebyZB4gccs='
WHERE
key_id = 'a176a1428ee5a406e6661237391d52c8d9215bd3fe669b4e193e8d8b1ffbae56'
AND (
token = '0RQ0pDCjlb+aR+zvPg2Tn9oVwQAlUxWCgebyZB4gccs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)