UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dXKES0IFt1aWB2rkJ7VIz/IQRA9DG48vKSH8nc0B/h0='
WHERE
key_id = 'ae3ddb1bbbdd06c7607ef6efec7d16d0eb21a12d94d39bc8397892a6325795b8'
AND (
token = 'dXKES0IFt1aWB2rkJ7VIz/IQRA9DG48vKSH8nc0B/h0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)