UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2tz8PRCkBZFIB3+JdW6kA9gcz/gj1ihIrHQpwHN1ArQ='
WHERE
key_id = 'c678542c263f087717c4dcfb0f3efa166c6f1d2feb1dc5adea8ded7ff1272beb'
AND (
token = '2tz8PRCkBZFIB3+JdW6kA9gcz/gj1ihIrHQpwHN1ArQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)