UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NIuENmaG9M24pTXp3HBTZ3yJYrtTBZphiUSi1xjL73k='
WHERE
key_id = '3feb9bd65a5fc3658516343e7120dc3b148c462a9f1aa5f7be989a99db45da03'
AND (
token = 'NIuENmaG9M24pTXp3HBTZ3yJYrtTBZphiUSi1xjL73k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)